/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package requestManager;

import app.MyTable;
import java.awt.Component;
import javax.swing.JTable;
import lib.JButtonTable.ButtonRenderer;

/**
 *
 * @author yoshi
 */
public class ApproveButtonRenderer extends ButtonRenderer{

    public ApproveButtonRenderer() {
        super();
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        if(row % 2 == 0){
            this.setText(((ApproveButtonModel) value).getText());
            ApproveButtonModel md = (ApproveButtonModel) value;
            if(!(md.isEnable())){
                ((MyTable) table).disableButtonCell(row, column);
            }
        }
        
        return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    }

    @Override
    protected boolean isButtonEnable() {
        return ((ApproveButtonModel)(this.getBModel())).isEnable();
    }
    
}
